<?php

use Doraemon\pockets\constInterface\ApiCode;
use Doraemon\pockets\encrypt\Xxtea;

class RequestGolangPlugin extends Yaf_Request_Http implements ApiCode
{
    protected $params = [];

    public function __construct()
    {
        parent::__construct();

        $raw = parent::getRaw();

        if (!empty($raw)) {
            $this->params = json_decode($raw, true);
        }

    }

    public function getPost($name = null, $default = null)
    {
        if (empty($this->params)) {
            return parent::getPost($name, $default);
        }


        if (!empty($this->params[$name])) {
            return $this->params[$name];
        }

        return $default;
    }
}
